package com.itcheetah.springevent.observer.impl;

import com.itcheetah.springevent.observer.inter.Observer;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @className: MyGuardianObserver
 * @description: 土地公公观察者实现类
 * @author: cheetah
 * @date: 2021/11/30 11:21
 * @Version: 1.0
 */
@Component
public class MyGuardianObserver implements Observer {

    @Override
    public void update(String goldenCudgel) {
        if(upGoldenCudgel(goldenCudgel)) {
            System.out.println("土地公公出现了");
        }
    }

    public boolean upGoldenCudgel(String goldenCudgel){
        if(Objects.equals(goldenCudgel,"down")){
            return true;
        }
        return false;
    }

}
